package com.example.generator.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.generator.entity.TableInfo;
import com.example.generator.mapper.GeneratorMapper;
import com.example.generator.service.IGeneratorService;
import com.example.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * @author Jiamingzhen
 * @Date 2021/4/23 8:56
 * @ClassName GeneratorServiceImpl
 * @Introduce
 */
@Service
public class GeneratorServiceImpl implements IGeneratorService {
    @Autowired
    private GeneratorMapper generatorMapper;

    @Override
    public PageResult<TableInfo> queryList(Integer pageNum,Integer pageSize,TableInfo tableInfo) {
        Page<TableInfo> page = new Page<TableInfo>(pageNum, pageSize);
        QueryWrapper<TableInfo> warper = Wrappers.<TableInfo>query();
        IPage<TableInfo> tableInfoIPage = generatorMapper.selectTabInfoList(page, warper);
        return new PageResult(tableInfoIPage.getRecords(),tableInfoIPage.getTotal());
    }
}
